package com.bawei.router

import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.facade.callback.NavigationCallback
import com.bawei.base.path.RoutePath

/**
 * Author: Jason Zhang
 * Date: 2025/4/24
 * Desc: 局部降级策略
 */
class LocalDegradeCallback(private val path: String = "", private val group: String = ""): NavigationCallback {

    /**
     * 匹配到目标页面
     */
    override fun onFound(postcard: Postcard?) {

    }

    /**
     * 没有匹配到目标页面
     */
    override fun onLost(postcard: Postcard) {
        postcard.group = if (!group.isNullOrEmpty()) group else RoutePath.GROUP_EMPTY
        postcard.path = if (!path.isNullOrEmpty()) path else RoutePath.PATH_EMPTY_PAGE
        postcard.navigation()
    }

    /**
     * 页面跳转成功
     */
    override fun onArrival(postcard: Postcard?) {

    }

    /**
     * 页面跳转被拦截
     */
    override fun onInterrupt(postcard: Postcard?) {

    }


}